﻿<%@ page language="java" import="java.util.*, com.onlinesys.beans.UserInfo, com.opensymphony.xwork2.ActionContext;" pageEncoding="UTF-8"%>
<%
		String path = request.getContextPath();
		String basePath = request.getScheme() + "://" + request.getServerName()
				+ ":" + request.getServerPort() + path + "/";
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>main</title>
<LINK href="./css/style.css" type=text/css rel=stylesheet>
<LINK href="./css/main.css" type=text/css rel=stylesheet>
<script src="./js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="./js/main.js" type="text/javascript"></script>
<script src="./js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="./js/jquery.validate.min.js" type="text/javascript"></script>
<script src="./js/validate.js" type="text/javascript"></script>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #5CB7FE;
}
.STYLE1 {font-size: 12px}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}
a:active {
	text-decoration: none;
}
.STYLE5 {font-size: 12px; color: #FF0000; }
.STYLE6 {
	font-size: 16px;
	font-weight: bold;
}
-->
 </style>
</head>
<script language="javascript">
$(document).ready(function(){
  $("#onlineType").change(function(){
  	$("#type").val($(this).children('option:selected').val());
  	$("#drawingNum").val("");
  	$("#vendor").val("");
  	$("#area").val("");
  	$("#quantity").val("");
  	$("#sdate").val("");
  	$("#edate").val("");
  	$("#searchform").submit();
  });
  $("#area").keydown(function(event) {
        var keyCode = event.which;
        if (keyCode == 46 || keyCode == 8 || keyCode == 190 || (keyCode >= 48 && keyCode <= 57) || (keyCode >= 96 && keyCode <= 105) || keyCode == 110) {
            return true;
        } else { return false; }
    }).focus(function() {
        this.style.imeMode = 'disabled';
    });
    $("#quantity").keydown(function(event) {
        var keyCode = event.which;
        if (keyCode == 46 || keyCode == 8 || (keyCode >= 48 && keyCode <= 57) || (keyCode >= 96 && keyCode <= 105) || keyCode == 110) {
            return true;
        } else { return false; }
    }).focus(function() {
        this.style.imeMode = 'disabled';
    });
    $("#newProductCount").keyup(function(event){
    	sum();
    });
    $("#newDiscardCount").keyup(function(event){
    	sum();
    });
    $("#newMissedCount").keyup(function(event){
    	sum();
    });	
});

function sum() {
    var mysum = parseInt($("#newProductCount").val()) + parseInt($("#newDiscardCount").val()) + parseInt($("#newMissedCount").val());
	$("#newQuantity").val(mysum);
}

var popupStatus = 0;
 $(function(){
   var $place = function(selector){//目标居中,目标应为绝对定位
     var $t=( $(window).height()-$(selector).height())/2;
     var $l=( $(window).width()-$(selector).width())/2;    
     $(selector).css({"left":$l+"px","top":$t+"px"});
   }
   
   $("#close").click(function(){
     //仅在开启标志popupStatus为1的情况下去除     
     if(popupStatus==1){
      $("#screen").fadeOut("slow");
      $("#showdiv").fadeOut("slow");
      popupStatus = 0;
     }      
   });
   
   $("#move").mouseover(function(event){
    var _move=false;//移动标记
    var _x,_y;//鼠标离控件左上角的相对位置
    
    $("#move").mousedown(function(e){
     _move=true;     
     _x=e.pageX-parseInt($("#showdiv").css("left"));         
     _y=e.pageY-parseInt($("#showdiv").css("top"));          
    });
        
    $(document).mousemove(function(e){
     if(_move){
      var x=e.pageX - _x;//移动时根据鼠标位置计算控件左上角的绝对位置
      var y=e.pageY - _y;
      $("#showdiv").css({"top":y,"left":x});//控件新位置      
     }
    }).mouseup(function(){
     _move=false;         
    });     
  });
 });

 function loadPopup(){    
    //仅在开启标志popupStatus为0的情况下加载 
    if(popupStatus==0){
     $("#screen").css({
      "opacity": "0.5"
     });     
     $("#screen").fadeIn("slow");
     showDivCenter("#showdiv");
      $("body").css({"overflow":"hidden"});
     popupStatus= 1;    
    }
 } 
 
 function showDivCenter(div)
{
	  var wnd = $(window), doc = $(document);
	  var left = doc.scrollLeft();
	  var top = doc.scrollTop();
	 left += (wnd.width() - $(div).width())/2;
	  top += (wnd.height() - $(div).height())/2;
	   $(div).css("position","absolute");
	  $(div).css("top",top);
	  $(div).css("left",left);
	  $(div).fadeIn("slow");
}

function fn_edit(id, drawingNum, quantity, productCount, discardCount, missedCount, type) {
		$("#id").val(id);
		$("#newDrawingNum").val(drawingNum);
		$("#newQuantity").val(quantity);
		$("#type").val(type);
		if (type == '0') {
			$("#move").html("修改返修上线记录");
			$("#lineCountText").html("上线数量");
			$("#newProductCount").attr("disabled","disabled");
			$("#newDiscardCount").attr("disabled","disabled");
			$("#newMissedCount").attr("disabled","disabled");
			$("#newProductCount").val("");
			$("#newDiscardCount").val("");
			$("#newMissedCount").val("");
		} else {
			$("#move").html("修改返修下线记录");
			$("#lineCountText").html("下线数量");
			$("#newProductCount").removeAttr("disabled");
			$("#newMissedCount").removeAttr("disabled");
			$("#newDiscardCount").removeAttr("disabled");
			$("#newProductCount").val(productCount);
			$("#newDiscardCount").val(discardCount);
			$("#newMissedCount").val(missedCount);
		}
        $(window).resize(function(){$place ($("showdiv"));}); //调整浏览器大小    
        loadPopup();
}
function check_form() {
	var type = $("#type").val();
	var newQuantity = $("#newQuantity").val();
	if ( newQuantity == "" || !$.isNumeric(newQuantity) || newQuantity < 0) {
		alert("数量 应为不小于0的数字");
		return false;
	}
	if (type != 0) {
		var newProductCount = $("#newProductCount").val();
		var newDiscardCount = $("#newDiscardCount").val();
		var newMissedCount = $("#newMissedCount").val();
		if ( newProductCount == "" || !$.isNumeric(newProductCount) || newProductCount < 0) {
			alert("成品数量 应为不小于0的数字");
			return false;
		}
		if ( newDiscardCount == "" || !$.isNumeric(newDiscardCount) || newDiscardCount < 0) {
			alert("报废数量 应为不小于0的数字");
			return false;
		}
		if ( newMissedCount == "" || !$.isNumeric(newMissedCount) || newMissedCount < 0) {
			alert("丢失数量 应为不小于0的数字");
			return false;
		}
		if (parseInt(newQuantity) != (parseInt(newProductCount) + parseInt(newDiscardCount) + parseInt(newMissedCount))) {
			alert("下线数量应该等于成品数量+报废数量+掉槽数量");
			return false;
		}
	}
	return true;
}
</script> 

<body style="overflow-x:hidden">
<table width="100%" height="568" border="0" cellpadding="0"
	cellspacing="0" bordercolor="#D8EDFF">
	<!--DWLayoutTable-->
	<tr>
		<td height="8" colspan="4" valign="top"></td>
		<td width="834" valign="top"></td>
		<td width="5" valign="top"></td>
	</tr>
	<tr>
		<td height="5" colspan="3" align="right" valign="top"><img
			src="images/icon1.jpg" width="6" height="5" /></td>
		<td colspan="2" valign="top"><img src="images/icon2.jpg" width="100%"
			height="5" /></td>
		<td valign="top"><img src="images/icon3.jpg" width="5" height="5" /></td>
	</tr>
	<tr>
		<td width="7" height="523">&nbsp;</td>
		<td width="5" align="right" valign="top" background="images/icon5.jpg"><img
			src="images/icon5.jpg" width="5" height="5" /></td>
		<td colspan="2" valign="top" bgcolor="#D8EDFF">&nbsp;</td>
		<td valign="top" background="images/main_bg.png">
		
		<table width="100%" border="0" cellpadding="0" cellspacing="0"
			bgcolor="#D8EDFF">
			<!--DWLayoutTable-->
			<tr>
				<td height="30" colspan="3" valign="middle"><span class="STYLE1">&nbsp;[返修历史记录]</span></td>
				<td width="29"></td>
			</tr>
			<tr>
				<td height="59" colspan="3" align="center" valign="middle" class="STYLE6">
					返&nbsp;&nbsp;修&nbsp;&nbsp;历 &nbsp;&nbsp;史 &nbsp;&nbsp;信&nbsp;&nbsp;息
				</td>
				<td>&nbsp;</td>
			</tr>
			<tr>
				<td width="90" height="345">&nbsp;</td>
				<td width="90%" valign="top">
		<form name="srchFrm" id="searchform" method="post" action="repairlineHistory.action">
			 <fieldset>
   				 <legend class="STYLE1"><img alt="查询" src="images/search.png"/> &nbsp;&nbsp;查 询</legend>
					<s:if test="msg != null"> 
   				 	<div id="msg">
   				 		<table>
   				 			<tr>
   				 				<td width="1%"><img src="images/error.gif"></td>
   				 				<td>&nbsp;&nbsp;<span id="msgText"><s:property value="msg"/></span></td>
   				 				<td width="1%"><img src="images/close.png" alt="关闭" style="cursor:pointer;" onclick="closeMsgBox()"/></td>
   				 			</tr>
   				 		</table>
   				 	</div>
					</s:if>
					<table>
						<tr>
						  <td width="120" align="right" valign="middle"><span class="STYLE1">图号：</span></td>
						  <td width="122" valign="middle"><input name="drawingNum" id="drawingNum" type="text" size="16" maxlength="20" style="width:100px; height:18px;" value="<s:property value="drawingNum"/>"></td>
						  <td width="120" align="right" valign="middle"><span class="STYLE1">厂家：</span></td>
						  <td width="122" valign="middle"><input name="vendor" id="vendor" type="text" size="16" maxlength="20" style="width:100px; height:18px;" value="<s:property value="vendor"/>"></td>
						  <td width="120" align="right" valign="middle"><span class="STYLE1">面积：</span></td>
						  <td width="122" valign="middle"><input name="area" id="area" type="text" size="16" maxlength="20" style="width:100px; height:18px;" value="<s:property value="area"/>"></td>
						
					  	</tr>
						<tr>
						  <td align="right" valign="middle"><span class="STYLE1">数量：</span></td>
						  <td valign="middle"><input name="quantity" id="quantity" type="text" size="16" maxlength="20" style="width:100px; height:18px;" value="<s:property value="quantity"/>"></td>
						  <td align="right" valign="middle"><span class="STYLE1">起始日期：</span></td>
						  <td valign="middle"><!-- <input name="slogDate" id="sdate" for="sdate" type="text" onDblClick="setday(this,slogDate)" dataType="Date" format="ymd" size="16" maxlength="20" style="width:80px; height:18px;" onClick="setday(this,slogDate)" value="<s:property value="slogDate"/>"> -->
						  	<input name="slogDate" type="text" id="sdate" onclick="WdatePicker({skin:&#39;whyGreen&#39;,dateFmt:&#39;yyyy-MM-dd&#39;})" size="10" maxlength="10" style="width:100px; height:18px;" readonly="readonly" value="<s:property value="slogDate"/>"/>
						  </td>
						  <td align="right" valign="middle"><span class="STYLE1">结束日期：</span></td>
						  <td valign="middle"><!-- <input name="elogDate" id="edate" type="text" onDblClick="setday(this,elogDate)" dataType="Date" format="ymd" size="16" maxlength="20" style="width:80px; height:18px;" onClick="setday(this,elogDate)" value="<s:property value="elogDate"/>"> -->
						  <input name="elogDate" type="text" id="edate" onclick="WdatePicker({skin:&#39;whyGreen&#39;,dateFmt:&#39;yyyy-MM-dd&#39;})" size="10" maxlength="10" style="width:100px; height:18px;" readonly="readonly" value="<s:property value="elogDate"/>"/>
						  </td>
						  <td align="right" valign="middle"><span class="STYLE1"></span></td>
						  <td align="center" valign="middle"><input name="sbt" type="submit" class="btn1_mouseout" onMouseOver="this.className='btn1_mouseover'" onMouseOut="this.className='btn1_mouseout'" value=" 查 询 "></td>
						  <td><input name="search" type="hidden" value="true"/></td>
					  	</tr>
				  </table>
		  	 </fieldset>
		  </form>
				<FORM name="form1" method="post">
				<table width="100%" border=0 cellpadding=0 cellspacing=1
					bgcolor=5cb7fe>
					<!--DWLayoutTable-->
					<tr>
						<td width="107" height="25" align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1">序号 </span></td>
				   		<td width="93" align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1">图号</span></td>
						<td width="113" align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1">厂家</span></td>
						<td width="115" align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1">面积 (m&sup2)</span></td>
				        <td width="115" align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1">数量</span></td>
						<td width="115" align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1">成品数量</span></td>
						<td width="115" align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1">报废数量</span></td>
						<td width="115" align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1">掉槽数量</span></td>		
						<td width="118" align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1">返修线</span></td>
						<td width="118" align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1">类型</span></td>
				        <td width="200" align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1">
							时间</span></td>
						<td width="118" align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1">下线班次</span></td>
						<%  UserInfo ui = (UserInfo)ActionContext.getContext().getSession().get("user"); 
							if (ui.getGroupRight() == 2){ %>
						<td width="100" align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1">操作</span></td>
						<% } %>
					</tr>
					<s:iterator value="pps" status="st">
					<tr>
					  <td height="25" align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1"><s:property value="#st.count + (currentPage - 1) * pageSize"/></span></td>
					  <td align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1"><s:property value="drawingNum"/></span></td>
					 <td align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1"><s:property value="vendor"/></span></td>
					  <td align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1"><s:property value="area"/></span></td>		
					  <td align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1"><s:property value="quantity"/></span></td>
					  <td align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1"><s:if test="type == 0">-</s:if><s:else><s:property value="productCount"/></s:else></span></td>
					  <td align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1"><s:if test="type == 0">-</s:if><s:else><s:property value="discardCount"/></s:else></span></td>
					<td align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1"><s:if test="type == 0">-</s:if><s:else><s:property value="missedCount"/></s:else></span></td>		
					  <td align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1"><s:property value="productLine"/></span></td>
					  <td align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1"><s:if test="type == 0">上线</s:if><s:else>下线</s:else></span></td>
					  <td align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1"><s:date name="logDate" format="yyyy-MM-dd HH:mm:ss" /></span></td>
					  <td align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1"><s:if test="type == null">-</s:if><s:else><s:property value="className"/></s:else></span></td>
					  <%  if (ui.getGroupRight() == 2){ %>
					  <td align="center" valign="middle"
							bgcolor="#D8EDFF"><span class="STYLE1"><img src="images/settings.png"/> <a href="javascript:fn_edit(<s:property value="id"/>,'<s:property value="drawingNum"/>', <s:property value="quantity"/>, <s:property value="productCount"/>, <s:property value="discardCount"/>, <s:property value="missedCount"/>,  <s:property value="type"/>)" style="color: blue;">修改</a></span></td>
					  <%  } %>
				  </tr>
				  </s:iterator>
				  <tr>
				  	<td height="25" colspan="13" align="center" valign="middle" bgcolor="#D8EDFF"><span class="STYLE1"><s:if test="pageBar == ''">没有搜索到结果!</s:if><s:else><s:property value="pageBar" escape="false"/></s:else></span></td>
				  
				  </tr>
				</table>
				</FORM>
				</td>
				<td width="50">&nbsp;</td>
				<td>&nbsp;</td>
			</tr>
</table>
		</td>
		<td valign="top" background="images/icon6.jpg"><img
			src="images/icon6.jpg" width="5" height="100" /></td>
	</tr>

	<tr>
		<td height="5"></td>
		<td valign="top"><img src="images/icon7.jpg" width="5" height="5" /></td>
		<td colspan="3" valign="top"><img src="images/icon8.jpg" width="100%"
			height="5" /></td>
		<td valign="top"><img src="images/icon9.jpg" width="5" height="5" /></td>
	</tr>
	<tr>
		<td height="2"></td>
		<td></td>
		<td width="1"></td>
		<td width="6"></td>
		<td></td>
		<td></td>
	</tr>
</table>
<div id="screen"><!--该DIV用于锁屏--></div>
<div id="showdiv" style="width:300">
	<form name="editForm" id="editForm" method="post" action="repairlineHistory!modify.action" onsubmit="return check_form();">
	<table style="width:300" class="STYLE1" >
		<tr>
			<td style="text-align:center;" colspan="2"><span id="move"></span></td>
			<td><img id="close" src="./images/close.png" style="cursor:pointer;"></td>
		</tr>
		<tr>
			<td align="right" style="width:120px;">图号：</td>
			<td style="text-align:left;">
			<input type="text" id="newDrawingNum" name="newDrawingNum" size="16" maxlength="20" style="width:120px; height:18px;">
			</td>
			<td></td>
		</tr> 
		<tr>
			<td align="right" id="lineCountText">上线数量：</td>
			<td style="text-align:left;">
			<input type="text" id="newQuantity" name="newQuantity" size="16" maxlength="20" style="width:120px; height:18px;">
			</td>
			<td></td>
		</tr>
		<tr>
			<td align="right">成品数量：</td>
			<td style="text-align:left;">
			<input type="text" id="newProductCount" name="newProductCount" size="16" maxlength="20" style="width:120px; height:18px;">
			</td>
			<td></td>
		</tr>
		<tr>
			<td align="right">报废数量：</td>
			<td style="text-align:left;">
			<input type="text" id="newDiscardCount" name="newDiscardCount" size="16" maxlength="20" style="width:120px; height:18px;">
			</td>
			<td></td>
		</tr>
		<tr>
			<td align="right">掉槽数量：</td>
			<td style="text-align:left;">
			<input type="text" id="newMissedCount" name="newMissedCount" size="16" maxlength="20" style="width:120px; height:18px;">
			</td>
			<td></td>
		</tr>
		<tr>
			<td colspan="3"><div style="text-align:center; margin-top:10px;"><input type="hidden" id="id" name="id"/><input type="hidden" id="type" name="type"/><input align="top" type="submit" class="btn1_mouseout" value="提 交"/></div></td>
		</tr>
    </table>
    </form>
</div>
</body>
</html>
